import type internal from 'node:stream';

/*
 * @Author: ZhaoChenGuang
 * @Date: 2025-01-16 16:07:14
 * @Description:
 */
import { requestClient } from '#/api/request';

/*
 *  全系列restful api格式, 定义通用req对象
 *
 *  @author terrfly
 *  @site https://www.jeepay.vip
 *  @date 2021/5/8 07:18
 */
export const req = {
  // 通用列表查询接口
  list: (url: string, params: any) => {
    return requestClient.get(url, { params });
  },

  // 通用新增接口
  add: (url: string, data: any) => {
    return requestClient.post(url, data);
  },

  // 通用查询单条数据接口
  getById: (url: string, id: internal, params = {}) => {
    return requestClient.get(`${url}/${id}`, params);
  },

  // 通用修改接口
  updateById: (url: string, id: internal, data = {}) => {
    return requestClient.put(`${url}/${id}`, data);
  },

  // 通用删除接口
  delById: (url: string, id: internal) => {
    return requestClient.delete(`${url}/${id}`);
  },
};

/** 井队管理 */
export const API_URL_COMPANY_LIST = '/admin/company';
/** 工资管理 */
export const API_URL_PAYROLL_LIST = '/admin/payroll';

// 上传工资表
export async function uploadExcel(data: any) {
  return requestClient.upload('/admin/payroll/upload', data);
}

// 公司列表(全部)
export async function companyList() {
  return requestClient.get('/admin/company/all');
}
